home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / AIncludes / CursorDevices.a < prev    next >
Encoding:
Text File  |  1997-08-12  |  8.9 KB  |  289 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        CursorDevices.a
  3. ;
  4. ;    Contains:    Cursor Devices (mouse/trackball/etc) Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.0.1
  8. ;
  9. ;    Copyright:    © 1993-1997 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__CURSORDEVICES__') = 'UNDEFINED' THEN
  19. __CURSORDEVICES__ SET 1
  20.  
  21.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  22.     include 'Types.a'
  23.     ENDIF
  24.     IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
  25.     include 'MixedMode.a'
  26.     ENDIF
  27.  
  28. ;                        * * *  I M P O R T A N T  * * * 
  29. ;
  30. ;            You will need CursorDevicesGlue.o to use CDM from PowerPC
  31. ;
  32. ;
  33. ;    In order to use the Cursor Devices Manager (CDM) on PowerPC systems, you must 
  34. ;    link with the file CursorDevicesGlue.o and InterfaceLib 1.1.3.  This is necessary
  35. ;    because the original MixedMode transition code for CDM in InterfaceLib in ROM
  36. ;    was wrong.  The code in CursorDevicesGlue.o will check to see if the ROM has
  37. ;    been fixed and calls through to it if so.  If it detects that the ROM has not
  38. ;    been fixed, it uses its own implementation of the CDM MixedMode transition 
  39. ;    routines. 
  40. ;    
  41. ;
  42.  
  43.  
  44. ; typedef short                         ButtonOpcode
  45.  
  46. ;  ButtonOpcodes 
  47.  
  48. kButtonNoOp                        EQU        0                    ; No action for this button 
  49. kButtonSingleClick                EQU        1                    ; Normal mouse button 
  50. kButtonDoubleClick                EQU        2                    ; Click-release-click when pressed 
  51. kButtonClickLock                EQU        3                    ; Click on press, release on next press 
  52.  
  53. kButtonCustom                    EQU        6                    ; Custom behavior, data = CursorDeviceCustomButtonUPP 
  54. ;  Device Classes 
  55.  
  56. kDeviceClassAbsolute            EQU        0                    ; a flat-response device 
  57. kDeviceClassMouse                EQU        1                    ; mechanical or optical mouse 
  58. kDeviceClassTrackball            EQU        2                    ; trackball 
  59. kDeviceClassTrackPad            EQU        3
  60.  
  61. kDeviceClass3D                    EQU        6                    ; a 3D pointing device 
  62. ;  Structures used in Cursor Device Manager calls 
  63. CursorData                RECORD 0
  64. nextCursorData             ds.l    1                ; offset: $0 (0)        ;  next in global list 
  65. displayInfo                 ds.l    1                ; offset: $4 (4)        ;  unused (reserved for future) 
  66. whereX                     ds.l    1                ; offset: $8 (8)        ;  horizontal position 
  67. whereY                     ds.l    1                ; offset: $C (12)        ;  vertical position 
  68. where                     ds        Point            ; offset: $10 (16)        ;  the pixel position 
  69. isAbs                     ds.b    1                ; offset: $14 (20)        ;  has been stuffed with absolute coords 
  70. buttonCount                 ds.b    1                ; offset: $15 (21)        ;  number of buttons currently pressed 
  71. screenRes                 ds.l    1                ; offset: $16 (22)        ;  pixels per inch on the current display 
  72. privateFields             ds.w    22                ; offset: $1A (26)        ;  fields use internally by CDM 
  73. sizeof                     EQU *                    ; size:   $46 (70)
  74.                         ENDR
  75. ; typedef struct CursorData *            CursorDataPtr
  76.  
  77. CursorDevice            RECORD 0
  78. nextCursorDevice         ds.l    1                ; offset: $0 (0)        ;  pointer to next record in linked list 
  79. whichCursor                 ds.l    1                ; offset: $4 (4)        ;  pointer to data for target cursor 
  80. refCon                     ds.l    1                ; offset: $8 (8)        ;  application-defined 
  81. unused                     ds.l    1                ; offset: $C (12)        ;  reserved for future 
  82. devID                     ds.l    1                ; offset: $10 (16)        ;  device identifier (from ADB reg 1) 
  83. resolution                 ds.l    1                ; offset: $14 (20)        ;  units/inch (orig. from ADB reg 1) 
  84. devClass                 ds.b    1                ; offset: $18 (24)        ;  device class (from ADB reg 1) 
  85. cntButtons                 ds.b    1                ; offset: $19 (25)        ;  number of buttons (from ADB reg 1) 
  86. filler1                     ds.b    1                ; offset: $1A (26)        ;  reserved for future 
  87. buttons                     ds.b    1                ; offset: $1B (27)        ;  state of all buttons 
  88. buttonOp                 ds.b    8                ; offset: $1C (28)        ;  action performed per button 
  89. buttonTicks                 ds.l    8                ; offset: $24 (36)        ;  ticks when button last went up (for debounce) 
  90. buttonData                 ds.l    8                ; offset: $44 (68)        ;  data for the button operation 
  91. doubleClickTime             ds.l    1                ; offset: $64 (100)        ;  device-specific double click speed 
  92. acceleration             ds.l    1                ; offset: $68 (104)        ;  current acceleration 
  93. privateFields             ds.w    15                ; offset: $6C (108)        ;  fields used internally to CDM 
  94. sizeof                     EQU *                    ; size:   $8A (138)
  95.                         ENDR
  96. ; typedef struct CursorDevice *            CursorDevicePtr
  97.  
  98. ;  for use with CursorDeviceButtonOp when opcode = kButtonCustom 
  99. ;
  100. ; pascal OSErr CursorDeviceMove(CursorDevicePtr ourDevice, long deltaX, long deltaY)
  101. ;
  102.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  103.         Macro
  104.         _CursorDeviceMove
  105.             moveq               #0,D0
  106.             dc.w                $AADB
  107.         EndM
  108.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  109.         IMPORT_CFM_FUNCTION CursorDeviceMove
  110.     ENDIF
  111.  
  112. ;
  113. ; pascal OSErr CursorDeviceMoveTo(CursorDevicePtr ourDevice, long absX, long absY)
  114. ;
  115.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  116.         Macro
  117.         _CursorDeviceMoveTo
  118.             moveq               #1,D0
  119.             dc.w                $AADB
  120.         EndM
  121.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  122.         IMPORT_CFM_FUNCTION CursorDeviceMoveTo
  123.     ENDIF
  124.  
  125. ;
  126. ; pascal OSErr CursorDeviceFlush(CursorDevicePtr ourDevice)
  127. ;
  128.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  129.         Macro
  130.         _CursorDeviceFlush
  131.             moveq               #2,D0
  132.             dc.w                $AADB
  133.         EndM
  134.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  135.         IMPORT_CFM_FUNCTION CursorDeviceFlush
  136.     ENDIF
  137.  
  138. ;
  139. ; pascal OSErr CursorDeviceButtons(CursorDevicePtr ourDevice, short buttons)
  140. ;
  141.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  142.         Macro
  143.         _CursorDeviceButtons
  144.             moveq               #3,D0
  145.             dc.w                $AADB
  146.         EndM
  147.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  148.         IMPORT_CFM_FUNCTION CursorDeviceButtons
  149.     ENDIF
  150.  
  151. ;
  152. ; pascal OSErr CursorDeviceButtonDown(CursorDevicePtr ourDevice)
  153. ;
  154.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  155.         Macro
  156.         _CursorDeviceButtonDown
  157.             moveq               #4,D0
  158.             dc.w                $AADB
  159.         EndM
  160.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  161.         IMPORT_CFM_FUNCTION CursorDeviceButtonDown
  162.     ENDIF
  163.  
  164. ;
  165. ; pascal OSErr CursorDeviceButtonUp(CursorDevicePtr ourDevice)
  166. ;
  167.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  168.         Macro
  169.         _CursorDeviceButtonUp
  170.             moveq               #5,D0
  171.             dc.w                $AADB
  172.         EndM
  173.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  174.         IMPORT_CFM_FUNCTION CursorDeviceButtonUp
  175.     ENDIF
  176.  
  177. ;
  178. ; pascal OSErr CursorDeviceButtonOp(CursorDevicePtr ourDevice, short buttonNumber, ButtonOpcode opcode, long data)
  179. ;
  180.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  181.         Macro
  182.         _CursorDeviceButtonOp
  183.             moveq               #6,D0
  184.             dc.w                $AADB
  185.         EndM
  186.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  187.         IMPORT_CFM_FUNCTION CursorDeviceButtonOp
  188.     ENDIF
  189.  
  190. ;
  191. ; pascal OSErr CursorDeviceSetButtons(CursorDevicePtr ourDevice, short numberOfButtons)
  192. ;
  193.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  194.         Macro
  195.         _CursorDeviceSetButtons
  196.             moveq               #7,D0
  197.             dc.w                $AADB
  198.         EndM
  199.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  200.         IMPORT_CFM_FUNCTION CursorDeviceSetButtons
  201.     ENDIF
  202.  
  203. ;
  204. ; pascal OSErr CursorDeviceSetAcceleration(CursorDevicePtr ourDevice, Fixed acceleration)
  205. ;
  206.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  207.         Macro
  208.         _CursorDeviceSetAcceleration
  209.             moveq               #8,D0
  210.             dc.w                $AADB
  211.         EndM
  212.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  213.         IMPORT_CFM_FUNCTION CursorDeviceSetAcceleration
  214.     ENDIF
  215.  
  216. ;
  217. ; pascal OSErr CursorDeviceDoubleTime(CursorDevicePtr ourDevice, long durationTicks)
  218. ;
  219.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  220.         Macro
  221.         _CursorDeviceDoubleTime
  222.             moveq               #9,D0
  223.             dc.w                $AADB
  224.         EndM
  225.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  226.         IMPORT_CFM_FUNCTION CursorDeviceDoubleTime
  227.     ENDIF
  228.  
  229. ;
  230. ; pascal OSErr CursorDeviceUnitsPerInch(CursorDevicePtr ourDevice, Fixed resolution)
  231. ;
  232.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  233.         Macro
  234.         _CursorDeviceUnitsPerInch
  235.             moveq               #10,D0
  236.             dc.w                $AADB
  237.         EndM
  238.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  239.         IMPORT_CFM_FUNCTION CursorDeviceUnitsPerInch
  240.     ENDIF
  241.  
  242. ;
  243. ; pascal OSErr CursorDeviceNextDevice(CursorDevicePtr *ourDevice)
  244. ;
  245.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  246.         Macro
  247.         _CursorDeviceNextDevice
  248.             moveq               #11,D0
  249.             dc.w                $AADB
  250.         EndM
  251.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  252.         IMPORT_CFM_FUNCTION CursorDeviceNextDevice
  253.     ENDIF
  254.  
  255. ;
  256. ; pascal OSErr CursorDeviceNewDevice(CursorDevicePtr *ourDevice)
  257. ;
  258.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  259.         Macro
  260.         _CursorDeviceNewDevice
  261.             moveq               #12,D0
  262.             dc.w                $AADB
  263.         EndM
  264.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  265.         IMPORT_CFM_FUNCTION CursorDeviceNewDevice
  266.     ENDIF
  267.  
  268. ;
  269. ; pascal OSErr CursorDeviceDisposeDevice(CursorDevicePtr ourDevice)
  270. ;
  271.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  272.         Macro
  273.         _CursorDeviceDisposeDevice
  274.             moveq               #13,D0
  275.             dc.w                $AADB
  276.         EndM
  277.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  278.         IMPORT_CFM_FUNCTION CursorDeviceDisposeDevice
  279.     ENDIF
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.     ENDIF ; __CURSORDEVICES__ 
  287.  
  288.